import { PageContainer } from '@ant-design/pro-layout';
import { message, Tabs, Spin,Alert, Badge } from 'antd';
import React from 'react';
import Attribution from './Attribution';
import OfficeReview from './OfficeReview';
class index extends React.Component {
    constructor(props) {
        super(props);
        this.state = { 
            tabKey:'1',
            userInfo:JSON.parse(sessionStorage.getItem("userInfo")),
            loading:true
         };
    }
    componentWillMount(){
    }
    getWillReviewCount=()=>{

    }

    tabChange=(e)=>{
        this.setState({
            tabKey:e
        })
    }
    tips=()=>{
        return<Alert
        message="权限异常"
        description="您没有权限查看本页面，如有疑问，请联系管理员"
        type="info"
        />
    }
    render() {
        const {tabKey,userInfo,loading} = this.state
        return (
            <PageContainer>
                
                <Tabs onChange={this.tabChange}  centered defaultActiveKey={'1'}>
                    <Tabs.TabPane tab={<Badge count={0} offset={[10, -5]}>创新办公室审批</Badge>} key={'1'}>
                        {(tabKey==='1'&&userInfo.targs.includes("办公室"))?<OfficeReview freshCount={this.getWillReviewCount}/>:this.tips()}
                    </Tabs.TabPane>
                    <Tabs.TabPane tab={<Badge count={0} offset={[10, -5]}>归口部门审批</Badge>} key={'2'}>
                        {(tabKey==='2'&&userInfo.roleName.includes("部门负责人"))?<Attribution freshCount={this.getWillReviewCount}/>:this.tips()}
                    </Tabs.TabPane>
                    
                   
                </Tabs>
                
            </PageContainer>
        );
    }
}

export default index;